package com.xm.xmapp.adapter;

import java.util.ArrayList;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class MyPagerAdapters extends FragmentStatePagerAdapter  {
	public ArrayList<Fragment> fragmentsList;
	private String[] title;

	public MyPagerAdapters(FragmentManager fm) {
		super(fm);
	}

	public MyPagerAdapters(String[] title, FragmentManager fm,
			ArrayList<Fragment> fragments) {
		super(fm);
		this.title = title;
		this.fragmentsList = fragments;
	}

	@Override
	public int getCount() {
		return fragmentsList.size();
	}

	@Override
	public Fragment getItem(int arg0) {

		return fragmentsList.get(arg0);
	}

	@Override
	public CharSequence getPageTitle(int position) {
		if (title != null)
			return title[position];
		else
			return null;
	}

	@Override
	public int getItemPosition(Object object) {
		return POSITION_UNCHANGED;
	}
}
